<template>
  <div>
    <V-CommonHeaderLeft>
      <div id="app">
        <el-row>
          <!-- 头部 -->
          <div class="header">
            <el-col :span="3" class="header-nav">
              <router-link to="/">首页&nbsp;&nbsp;/</router-link>
              <router-link to="/">客户&nbsp;&nbsp;/</router-link>
              <router-link to="/">下单分析</router-link>
            </el-col>
            <el-col :span="1" :offset="20" class="header-img">
              <!-- <img src="" alt=""> -->
            </el-col>
          </div>
        </el-row>
        <div class="contents">
          <el-tabs v-model="activeName" class="planeTitle">
            <el-tab-pane label="近7天下单" name="first">
              <div class="firstOrder">
                <input type="search" name id class="firstOrderSearch" placeholder="请输入客户名称/联系人/手机号">
                <el-select v-model="valueCus" placeholder="请选择客户类型" class="plac">
                  <el-option
                    v-for="item in optionsCus"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-cascader
                  v-model="value"
                  :options="options"
                  placeholder="请选择归属区域"
                  filterable
                  empty="没有相关内容"
                  clearable
                  class="plac"
                ></el-cascader>
                <el-select v-model="valuePer" placeholder="请选择所属员工" class="plac">
                  <el-option
                    v-for="item in optionsPer"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-row class="cusRejectRow">
                  <el-col :span="8" class="cusRejectRowShu">
                    <span>客户数量</span>
                    <span>0</span>
                  </el-col>
                  <el-col :span="8" class="cusRejectRowShu">
                    <span>近7天订单量</span>
                    <span>0</span>
                  </el-col>
                  <el-col :span="8" class="cusRejectRowShu">
                    <span>近7天订单金额</span>
                    <span>￥0.00</span>
                  </el-col>
                </el-row>
                <el-table
                  :data="tableData"
                  :default-sort="{prop: 'date', order: 'descending'}"
                  class="tableData"
                >
                  <el-table-column prop="date" label="客户名称"></el-table-column>
                  <el-table-column prop="name" label="客户类型"></el-table-column>
                  <el-table-column prop="date" label="所属区域"></el-table-column>
                  <el-table-column prop="name" label="所属员工"></el-table-column>
                  <el-table-column prop="date" label="注册时间" sortable></el-table-column>
                  <el-table-column prop="name" label="最近登陆" sortable></el-table-column>
                  <el-table-column prop="date" label="最近下单" sortable></el-table-column>
                  <el-table-column prop="name" label="订单量" sortable></el-table-column>
                  <el-table-column prop="date" label="订单金额" sortable></el-table-column>
                  <el-table-column prop="name" label="下单频率" sortable></el-table-column>
                  <el-table-column prop="date" label="客单价" sortable></el-table-column>
                </el-table>
              </div>
            </el-tab-pane>
            <el-tab-pane label="近30天下单" name="second">
              <div class="firstOrder">
                <input type="search" name id class="firstOrderSearch" placeholder="请输入客户名称/联系人/手机号">
                <el-select v-model="valueCus" placeholder="请选择客户类型" class="plac">
                  <el-option
                    v-for="item in optionsCus"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-cascader
                  v-model="value"
                  :options="options"
                  placeholder="请选择归属区域"
                  filterable
                  empty="没有相关内容"
                  clearable
                  class="plac"
                ></el-cascader>
                <el-select v-model="valuePer" placeholder="请选择所属员工" class="plac">
                  <el-option
                    v-for="item in optionsPer"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-row class="cusRejectRow">
                  <el-col :span="8" class="cusRejectRowShu">
                    <span>客户数量</span>
                    <span>0</span>
                  </el-col>
                  <el-col :span="8" class="cusRejectRowShu">
                    <span>近7天订单量</span>
                    <span>0</span>
                  </el-col>
                  <el-col :span="8" class="cusRejectRowShu">
                    <span>近7天订单金额</span>
                    <span>￥0.00</span>
                  </el-col>
                </el-row>
                <el-table
                  :data="tableData"
                  :default-sort="{prop: 'date', order: 'descending'}"
                  class="tableData"
                >
                  <el-table-column prop="date" label="客户名称"></el-table-column>
                  <el-table-column prop="name" label="客户类型"></el-table-column>
                  <el-table-column prop="date" label="所属区域"></el-table-column>
                  <el-table-column prop="name" label="所属员工"></el-table-column>
                  <el-table-column prop="date" label="注册时间" sortable></el-table-column>
                  <el-table-column prop="name" label="最近登陆" sortable></el-table-column>
                  <el-table-column prop="date" label="最近下单" sortable></el-table-column>
                  <el-table-column prop="name" label="订单量" sortable></el-table-column>
                  <el-table-column prop="date" label="订单金额" sortable></el-table-column>
                  <el-table-column prop="name" label="下单频率" sortable></el-table-column>
                  <el-table-column prop="date" label="客单价" sortable></el-table-column>
                </el-table>
              </div>
            </el-tab-pane>
            <el-tab-pane label="近7天未下单" name="third">
              <div class="thirdOrder">
                <input type="search" name id class="firstOrderSearch" placeholder="请输入客户名称/联系人/手机号">
                <el-select v-model="valueCus" placeholder="请选择客户类型" class="plac">
                  <el-option
                    v-for="item in optionsCus"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-cascader
                  v-model="value"
                  :options="options"
                  placeholder="请选择归属区域"
                  filterable
                  empty="没有相关内容"
                  clearable
                  class="plac"
                ></el-cascader>
                <el-select v-model="valuePer" placeholder="请选择所属员工" class="plac">
                  <el-option
                    v-for="item in optionsPer"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-table
                  v-for="(site,key) in tableDataThird" :key='key'
                  :data="tableDataThird"
                  :default-sort="{prop: 'date', order: 'descending'}"
                  class="tableData"
                  style='margin-top:20px;border-top:1px solid #e3e3e3'
                >
                  <el-table-column label="客户名称" width='280px'>
                    <div class='cusName'>
                      <router-link to='/customerListDetails'>{{site.name}}</router-link>
                    </div>
                  </el-table-column>
                  <el-table-column prop="type" label="客户类型"></el-table-column>
                  <el-table-column prop="quyu" label="所属区域"></el-table-column>
                  <el-table-column prop="per" label="所属员工"></el-table-column>
                  <el-table-column prop="time" label="注册时间" sortable></el-table-column>
                  <el-table-column prop="login" label="最近登陆" sortable></el-table-column>
                  <el-table-column prop="order" label="最近下单" sortable></el-table-column>
                  <el-table-column prop="count" label="订单量" sortable></el-table-column>
                  <el-table-column label="订单金额" sortable>￥{{site.orderPrice}}</el-table-column>
                  <el-table-column label="下单频率" sortable>{{site.orderCount}}天</el-table-column>
                  <el-table-column label="客单价" sortable>￥{{site.price}}</el-table-column>
                </el-table>
              </div>
            </el-tab-pane>
            <el-tab-pane label="近30天未下单" name="fourth">
              <div class="thirdOrder">
                <input type="search" name id class="firstOrderSearch" placeholder="请输入客户名称/联系人/手机号">
                <el-select v-model="valueCus" placeholder="请选择客户类型" class="plac">
                  <el-option
                    v-for="item in optionsCus"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-cascader
                  v-model="value"
                  :options="options"
                  placeholder="请选择归属区域"
                  filterable
                  empty="没有相关内容"
                  clearable
                  class="plac"
                ></el-cascader>
                <el-select v-model="valuePer" placeholder="请选择所属员工" class="plac">
                  <el-option
                    v-for="item in optionsPer"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
                <el-table
                  v-for="(site,key) in tableDataThird" :key='key'
                  :data="tableDataThird"
                  :default-sort="{prop: 'date', order: 'descending'}"
                  class="tableData"
                  style='margin-top:20px;border-top:1px solid #e3e3e3'
                >
                  <el-table-column label="客户名称" width='280px'>
                    <div class='cusName'>
                      <router-link to='/customerListDetails'>{{site.name}}</router-link>
                    </div>
                  </el-table-column>
                  <el-table-column prop="type" label="客户类型"></el-table-column>
                  <el-table-column prop="quyu" label="所属区域"></el-table-column>
                  <el-table-column prop="per" label="所属员工"></el-table-column>
                  <el-table-column prop="time" label="注册时间" sortable></el-table-column>
                  <el-table-column prop="login" label="最近登陆" sortable></el-table-column>
                  <el-table-column prop="order" label="最近下单" sortable></el-table-column>
                  <el-table-column prop="count" label="订单量" sortable></el-table-column>
                  <el-table-column label="订单金额" sortable>￥{{site.orderPrice}}</el-table-column>
                  <el-table-column label="下单频率" sortable>{{site.orderCount}}天</el-table-column>
                  <el-table-column label="客单价" sortable>￥{{site.price}}</el-table-column>
                </el-table>
              </div>
            </el-tab-pane>
          </el-tabs>
          <div class="daoFloat">
            <el-popover
              placement="top-start"
              title="标题"
              width="400"
              trigger="hover"
              content="1.下单频率:可用于了解客户的下单习惯，比如客户首次下单时间到最近一次下单时间间隔了30天，其中有15天有在系统下过单，则客户的下单频率为30/15=2天，即客户一般每隔两天会在系统下一次单;
                        2.客单价:可用于了解客户每个订单的平均价格，客单价=订单总金额订单量;
                        3.近7天/30天下单:你可以了解最近7天/30天客户的活跃情况及下单情况;
                        4.近7天/30天未下单:你可以了解最近7天/30天未下单的客户有哪些，针对下单频率异常的客户系统会自动标红，以便您及时跟进客情减少客户流失。
                        "
            >
              <el-button slot="reference" style="border:0;color:#999999">下单分析说明</el-button>
            </el-popover>
            <span>导出</span>
          </div>
        </div>
      </div>
    </V-CommonHeaderLeft>
  </div>
</template>

<script>
import VCommonHeaderLeft from '@/components/common/vCommonHeaderLeft/VCommonHeaderLeft'
export default {
  components: {
    VCommonHeaderLeft
  },
  data () {
    return {
      activeName: 'third',
      // 客户
      optionsCus: [{
        value: '选项1',
        label: '黄金糕'
      }],
      valueCus: '',
      // 员工
      optionsPer: [{
        value: '选项1',
        label: '黄金糕'
      }],
      valuePer: '',
      // 联级菜单
      value: [],
      options: [
        {
          value: 'zhinan',
          label: '指南',
          children: [{
            value: 'shejiyuanze',
            label: '设计原则',
            children: [{
              value: 'yizhi',
              label: '一致'
            }, {
              value: 'fankui',
              label: '反馈'
            }, {
              value: 'xiaolv',
              label: '效率'
            }, {
              value: 'kekong',
              label: '可控'
            }]
          }, {
            value: 'daohang',
            label: '导航',
            children: [{
              value: 'cexiangdaohang',
              label: '侧向导航'
            }, {
              value: 'dingbudaohang',
              label: '顶部导航'
            }]
          }]
        }, {
          value: 'zujian',
          label: '组件',
          children: [{
            value: 'basic',
            label: 'Basic',
            children: [{
              value: 'layout',
              label: 'Layout 布局'
            }, {
              value: 'color',
              label: 'Color 色彩'
            }, {
              value: 'typography',
              label: 'Typography 字体'
            }, {
              value: 'icon',
              label: 'Icon 图标'
            }, {
              value: 'button',
              label: 'Button 按钮'
            }]
          }]
        }
      ],
      tableData: [],
      tableDataThird: [
        {
          name: '张鹏',
          type: '普通代理商',
          quyu: '华东区',
          per: '王神诞02',
          time: '1年前',
          login: '1年前',
          order: '1年前',
          count: '2',
          orderPrice: '2,000.00',
          orderCount: '17.0',
          price: '1,101.0'
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
#app {
  background-color: #f2f5f7;
  width: 100%;
  padding: 15px 10px 0px 10px;
  .header {
    height: 45px;
    .header-nav {
      line-height: 30px;
      font-size: 12px;
      display: flex;
      justify-content: space-around;
      padding-left: 10px;
      span {
        display: inline-block;
        margin-left: 10px;
      }
      a {
        color: #999999;
      }
      a:hover {
        color: #20ade5;
      }
    }
    .header-img {
      width: 25px;
      height: 25px;
      border-radius: 5px;
      border: 1px solid #dce4e7;
    }
  }
}
.header-nav > a:last-child {
  color: #333 !important;
}
.header-nav > a:last-child:hover {
  color: #333;
}
.contents {
  padding: 15px 0px 0px 0px;
  background-color: #fff;
  height: 500px;
}
.planeTitle /deep/ .el-tabs__item {
  width: 145px;
  text-align: center;
  font-size: 16px;
}
.daoFloat {
  color: #20ade5;
  position: absolute;
  right: 30px;
  top: 130px;
}
.firstOrder {
}
.firstOrderSearch {
  width: 200px;
  height: 40px;
  border: 1px solid #e3e3e3;
  text-indent: 1em;
  border-radius: 5px;
  margin-left: 20px;
}
.firstOrderSearch:hover {
  border-color: #20ade5;
}
.firstOrderSearch::placeholder {
  font-size: 12px;
  color: #bababa;
}
.plac {
  margin-left: 20px;
}
.plac /deep/ .el-input__inner {
  font-size: 12px;
}
.cusRejectRow {
  text-align: center;
  margin-top: 15px;
  font-size: 12px;
  width: 98%;
}
.cusRejectRow span {
  display: block;
  color: #666666;
}
.cusRejectRow span:nth-child(2) {
  color: #333;
  font-weight: bold;
  margin-top: 10px;
  font-size: 16px;
}
.cusRejectRowShu {
  border-right: 1px solid #e3e3e3;
  border-top: 1px solid #e3e3e3;
  border-bottom: 1px solid #e3e3e3;
  height: 100px;
  padding-top: 30px;
}
.tableData /deep/ th {
  height: 20px;
  background-color: #fcfcfc;
  border-bottom: 1px solid #e3e3e3;
  font-weight: normal;
  font-size:12px;
}
.cusName>a:hover {
  color:#20ade5;
}
</style>
